use serde::{Deserialize, Serialize};
use common::page::{BasePage, PageData};

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct CreateCharacInfo {
    pub charac_no: Option<i32>,
    pub charac_name: Option<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct UpdateCharacInfo {
    pub charac_no: Option<i32>,
    pub charac_name: Option<String>,
    pub lev: Option<i8>,
    pub exp: Option<i32>,
    pub hp: Option<u8>,
    pub max_hp: Option<u16>,
    pub max_mp: Option<u16>,
    pub phy_attack: Option<u16>,
    pub phy_defense: Option<u16>,
    pub mag_attack: Option<u16>,
    pub mag_defense: Option<u16>,
    pub inven_weight: Option<i32>,
    pub hp_regen: Option<i16>,
    pub mp_regen: Option<i16>,
    pub move_speed: Option<u16>,
    pub attack_speed: Option<u16>,
    pub cast_speed: Option<u16>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct CharacInfoPage {
    pub page_data: Option<PageData>,
    pub charac_no: Option<i32>,
    pub charac_name: Option<String>,
}
impl BasePage for CharacInfoPage {
    fn get_page_data(&self) -> PageData {
        match self.page_data.clone() {
            None => {
                PageData{
                    page: 1,
                    page_size: 10,
                    sorter: None,
                }
            }
            Some(page_data) => {
                page_data
            }
        }
    }
}
